//
//  BVTabBarController.m
//  AssistantCloud1
//
//  Created by YYKJ on 2017/5/15.
//  Copyright © 2017年 YYKJ. All rights reserved.
//

#import "BVTabBarController.h"
#import "BVNavigationController.h"
#import "UIImage+BVImage.h"
#import "BVIndexViewController.h"
#import "BVDailyViewController.h"
#import "BVMineViewController.h"
#import "BVMyBaskListViewController.h"

@interface BVTabBarController ()

@end

@implementation BVTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupAllChildViewControllers];
}

- (void)setupAllChildViewControllers{
    
    BVIndexViewController *index = [[BVIndexViewController alloc] init];
    [self setupChildViewController:index image:[UIImage imageNamed:@"tabBar12"] selectImage:[UIImage imageWithOriginalName:@"tabBar13"] title:@"相豫首页"];
    
    BVDailyViewController *daily = [[BVDailyViewController alloc] init];
    [self setupChildViewController:daily image:[UIImage imageNamed:@"tabBar14"] selectImage:[UIImage imageWithOriginalName:@"tabBar15"] title:@"发现"];
    
    BVMyBaskListViewController *community = [[BVMyBaskListViewController alloc] init];
    [self setupChildViewController:community image:[UIImage imageNamed:@"tabBar16"] selectImage:[UIImage imageWithOriginalName:@"tabBar17"] title:@"幸运社区"];

    BVMineViewController *mine = [[BVMineViewController alloc] init];
    [self setupChildViewController:mine image:[UIImage imageNamed:@"tabBar18"] selectImage:[UIImage imageWithOriginalName:@"tabBar19"] title:@"个人中心"];
    
}

- (void)setupChildViewController:(UIViewController *)viewController image:(UIImage *)image selectImage:(UIImage *)selectImage title:(NSString *)title{
    
    viewController.title = title;
    viewController.tabBarItem.image = image;
    viewController.tabBarItem.selectedImage = selectImage;
    
    [viewController.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:COLOR_RGB(233, 28, 20, 1.0)} forState:UIControlStateSelected];
    
    BVNavigationController *nav = [[BVNavigationController alloc] initWithRootViewController:viewController];
    [self addChildViewController:nav];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
